<template>
 <el-select v-model="chid" clearable placeholder="请选择" >
 <el-option v-for="item in getlist" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</template>

<script>

export default {
  props: {
    cid: {
      default: 0
    }
  },
  created () {
    this.getList()
  },
  data () {
    return {
      getlist: [],
      chid: ''
    }
  },
  watch: {
    cid: function (newv) {
      this.chid = newv
    },
    chid: function (newv) {
      this.$emit('slt', newv)
    }
  },
  methods: {
    getList () {
      let pro = this.$http.get('/channels')
      pro.then(result => {
        let { data } = result.data
        this.getlist = data.channels
      }).catch(error => {
        this.$message.error('出错了' + error)
      })
    }
  }

}
</script>

<style lang="less" scoped>
</style>
